<template>
    <section class="event_rank">
        <p @click="refresh">刷新</p>
        <Table :columns="columns" :data="eventRankData"></Table>
    </section>
</template>
<script>
import { formatData } from '@/utils/format';
import { mapActions } from 'vuex';
export default {
    name:"eventRank",
    inject:['reload'],
    props:['id'],
    data(){
        return{
            columns:[
                {
                    title:"排名",
                    type:'index',
                    align:"center"
                },
                {
                    title:"团队",
                    key:"group_name",
                    align:"center"
                },
                {
                    title:"得分",
                    key:"score",
                    align:"center"
                },
                {
                    title:"提交次数",
                    key:"cubmint_count",
                    align:"center"
                },
                // {
                //     title:"最佳排名",
                //     key:"goodrank",
                //     align:"center"
                // },
                // {
                //     title:"最佳提交时间",
                //     key:"goodsubtime",
                //     align:"center"
                // },
                {
                    title:"最后提交时间",
                    key:"last_time",
                    align:"center",
                    render(h,params) {
                        return h('div',formatData(params.row.last_time))
                    },
                },
            ],
            eventRankData:[]
        }
    },
    methods:{
        ...mapActions(['XrankList']),
        refresh(){
            this.reload()
        }
    },
    mounted(){
        this.XrankList(this.id).then(res => { this.eventRankData = res.data })
    }
}
</script>
<style lang="scss" scoped>
    .event_rank{
        width: 1200px;
        margin: 0 auto 43px;
        border:1px solid #f7f7f7;
        p{
            display: inline-block;
            font-size:14px;
            color:#C2142F;
            position: relative;
            margin: 20px;
            left: 87%;
            cursor: pointer;
        }
    }
</style>